import { Toast } from "vant";
import cTitle from "components/title";
export default {
  components: {
    cTitle
  },
  data() {
    return {
      goodsId: 0,
      couponStoreGoods: {},
      writingText: "",
      goodsImg: [],
      thumb: ""
    };
  },
  activated() {
    this.goodsId = Number(this.$route.query.goodsId);
    this.getGoodsDetails(this.goodsId);
  },
  methods: {
    getGoodsDetails(id) {
      let json = {
        id: Number(id),
        basic_info: 1
      };
      $http.post("goods.goods.get-goods-page", json, "正在获取").then(
        response => {
          if (response.result == 1) {
            let res = response.data;
            this.couponStoreGoods = res.plugin?.coupon_store_goods;
            this.goodsImg = res.get_goods?.thumb_url;
            this.thumb = res.get_goods?.thumb;
          } else {
            this.$dialog.alert({ message: response.msg });
          }
        },
        function(response) {
          console.log(response);
        }
      );
    },
    copyBtn() {
      Toast("复制成功");
    },
    onError() {
      Toast("不能复制空文字");
    }
  }
};
